<%@ page language="java" contentType="application/vnd.ms-excel; name='member'; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*"%>
<%
response.setHeader("Content-Disposition", "inline; filename=member.xls"); // 파일 이름 지정
response.setHeader("Content-Description", "JSP Generated Data");
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Excel Download</title>
</head>
<%
	request.setCharacterEncoding("utf-8"); 
	UserSession usersession = (UserSession)session.getAttribute("user");
	String ent_id 			= CmmUtil.nvl(request.getParameter("ent_id"),"");
	
	String connGroup 	= "";
	String user_id 		= "";
	if(usersession!=null){
		connGroup 	= CmmUtil.nvl(usersession.getConnGroup(),"0");
		user_id 	= CmmUtil.nvl(usersession.getUser_id(),"");
	}
	String keyword_gb 	= CmmUtil.nvl(request.getParameter("search_gb"),"");
	String keyword 		= CmmUtil.nvl(request.getParameter("search_word"),"");
	
	System.out.println("keyword  " + keyword);
	
	String total_count = CmmUtil.nvl(request.getParameter("total_count"),"0");
 	
 	if(keyword_gb.equals("3")){
 		keyword = Crypto.EncodeBySType(keyword);
 	}
 	
	HashMap map = new HashMap();
	HashMap map1 = null;
	ArrayList list = new ArrayList();
	CommonDaoService commonservice = new CommonDaoService("Com0101lp03Dao");
	map.put("connGroup",connGroup);
	map.put("user_id",user_id);
	map.put("ent_id",ent_id);
	map.put("member_gb","");
	map.put("keyword_gb",keyword_gb);
	map.put("keyword",keyword);
	map.put("quit_yn","N");
	map.put("page_row",total_count);
	map.put("total_row","0");
	map.put("page_no","0");

	
	list = (ArrayList)commonservice.commonDaoMethod(map);
	
	
	//리스트에 뿌릴 사용자 정보
	String id 				="";
	String norm_phone_no 	="";
	String cell_phone_no 	="";
	String last_conn_dt		="";
	String uni_id			="";
	String login_nm			="";
	
%>
<body>
<form name="excel_frm">
<b></b>
</BR>
</BR>
<table width="760" border="1" cellpadding="2" cellspacing="0" bordercolor="C0C0C0" bordercolordark="#FFFFFF" frame=below >
	<tr height="23">
		<td width="45" bgcolor="#D3EBD7" align="center"> 성명 </td>
	    <td width="50" bgcolor="#D3EBD7" align="center"> 아이디 </td>
	    <td width="160" bgcolor="#D3EBD7" align="center"> 일반전화 </td>
	    <td width="160" bgcolor="#D3EBD7" align="center"> 휴대전화 </td>
	    <td width="200" bgcolor="#D3EBD7" align="center"> 최근접속일 </td>
	</tr>
	<% for (int i=0; i< list.size(); i++) {
		map1 = (HashMap)list.get(i);
    	id 				= Crypto.DecodeBySType((String)map1.get("login_id"));
    	cell_phone_no 	= CmmUtil.nvl((String)map1.get("cell_phone_no"),"--");
    	norm_phone_no 	= CmmUtil.nvl((String)map1.get("norm_phone_no"),"--");
    	last_conn_dt	= CmmUtil.nvl((String)map1.get("last_conn_dt") ,"--");
    	uni_id			= CmmUtil.nvl((String)map1.get("uni_id") ,"");
    	login_nm		= CmmUtil.nvl((String)map1.get("login_nm") ,"");
	%>
	<tr height="23">
		<td width="10" align="center"> <%= login_nm %> </td>
	    <td width="10" align="center"> <%= id %> </td>
	    <td width="10" align="center"> <%= norm_phone_no %> </td>
	    <td width="10" align="center"> <%= cell_phone_no %> </td>
	    <td width="10" align="center"> <%= last_conn_dt %> </td>
	</tr>
	<% }%>
</table>
</form>
</body>
</html>